#!/usr/bin/env
# -*- coding:utf-8 -*-
# __author__ = 'duanhun'
#
# try:
#     from django.core.cache import caches
# except Exception:
#     from django.core.cache import get_cache
# else:
#     def get_cache(alias):
#         return caches[alias]
#
# def connect_redis(alias='default', write=True):
#     cache = get_cache(alias)
#     if not hasattr(cache.client, 'get_client'):
#         raise NotImplementedError("This backend does not supports this feature")
#
#     return cache.client.get_client(write)